package core

import (
	"net/http"

	"github.com/gin-gonic/gin"
)

type Response struct {
	Code    int32       `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

func Ok(c *gin.Context, data interface{}, message string) {
	response := Response{Data: data, Code: SUCCESS_CODE, Message: message}
	c.JSON(http.StatusOK, response)
	//c.AbortWithStatusJSON(http.StatusOK, o)
}
func CustomError(c *gin.Context, message string) {
	response := Response{Data: nil, Code: CUSTOM_ERROR_CODE, Message: message}
	c.AbortWithStatusJSON(http.StatusOK, response)
}
func AuthError(c *gin.Context, message string) {
	response := Response{Data: nil, Code: AUTH_ERROR_CODE, Message: message}
	c.AbortWithStatusJSON(http.StatusOK, response)
}
